$(()=>{
    let $get = $("#get");
    let $inputbox = $("#inputbox");
    $inputbox.focus();
    let $main = $("#main");
    let $table = $("#table");
    let $item1 = $("#item1");
    let $item2 = $("#item2");
    let $item3 = $("#item3");
    let $item4 = $("#item4");
    $inputbox.keydown(e=>{if (e.keyCode===13)$get.click();});
    $(document).keydown(e=>{if(e.keyCode===36){if (e.ctrlKey){if(confirm("是否要返回上一页？")){location.href = "./?/index";}}else{if(confirm("是否要返回首页？")){history.back();}}}else if(e.keyCode===45){$inputbox.focus();}});
    $get.click(()=>{
        $main.addClass("el-loading");
        let qq = $inputbox.val();
        $.post("#",{
            qq:qq
        },text=>{
            $main.removeClass("el-loading");
            $table.hide();
            $table.removeClass("el-loading");
            let data = JSON.parse(text);
            if (data.success){
                $item1.text(qq);
                $item2.text(data.state);
                $table.fadeIn();
            }else {
                alert(data.message);
            }
            /*console.log(text);*/
        });
    });
});
